<template>
  <a-button
    type="link"
    style="padding: 4px 6px"
    @click="onClick"
    :loading="loading"
  >
    停止
  </a-button>
</template>
<script setup>
import { ref } from 'vue'
/**
 * 外部参数
 */
let props = defineProps({
  id: {
    type: String,
    required: true,
  },
})
/**
 * 事件定义
 */
let emit = defineEmits(['operated'])
/**
 * 操作
 */
let loading = ref(false)
function onClick() {
  loading.value = true
  setTimeout(() => {
    console.log(props.id)
    loading.value = false
    emit('operated')
  }, 1000)
}
</script>
<style lang="less" scoped></style>
